#include <iostream>

using namespace std;

extern "C"
{
    short a = 10;
    int b = (int)a;
}

void test1()
{
    //1. static_cast
    //forbid inlegal transfer
    int num1 = 100;
    float num2 = 10.1;
    num2 = static_cast<float>(num1);
    num1 = static_cast<int>(num2);

    int *pnum1 = &num1;
    float *pnum2 = &num2;
    void *pnum3;
    //pnum2 = static_cast<float*>(pnum1); error
    pnum3 = static_cast<void*>(pnum1);

    //2. const_cast
    //used to const varibale
    //point to const will transform to normall point
    //const ref will transform to normal ref

    const int num3 = 100;
    //int * pInt = &num3; error
    int * pInt = const_cast<int*>(&num3);

    //3. dynamic_cast
    //tranfer bettwen parent class and child class

    //4. reinterpret_cast
    //
}


int main()
{
    test1();
    return 0;
}

